Public Class P_Tenant
    Dim dtable As New DataTable
    Dim dadapter As New OleDb.OleDbDataAdapter
    Dim a As String

    Private Sub P_Tenant_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
        dadapter.Dispose()
        dadapter = Nothing
        DbCon.Close()
    End Sub
    Private Sub pilih_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'TODO: This line of code loads data into the 'Unit_MaintenanceDataSet.M_Tenant' table. You can move, or remove it, as needed.
        Me.Name = namafrm
        dtable.Clear()
        open_con()
        dadapter = New OleDb.OleDbDataAdapter(SQL, DbCon)
        dadapter.Fill(dtable)
        DataGridView1.DataSource = dtable
        DataGridView1.Columns(0).Visible = False

    End Sub

    Private Sub Ok_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Ok.Click
        pilih()
    End Sub

    Private Sub Cancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel.Click
        T_id = ""
        Me.Close()
    End Sub

    Private Sub DataGridView1_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellContentClick

    End Sub

    Private Sub DataGridView1_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles DataGridView1.DoubleClick
        pilih()
    End Sub
    Private Sub pilih()
        T_id = DataGridView1.Item(0, DataGridView1.CurrentRow.Index).Value
        a = DataGridView1.Item(1, DataGridView1.CurrentRow.Index).Value
        Me.Close()
    End Sub
    Public Function getselection() As String
        Me.ShowDialog()
        Return a
    End Function
End Class